#!/bin/bash
# Define the necessary variables
CONTROLLER_ADDRESS="http://localhost:21001"
WORKER_ADDRESS="http://192.168.6.137:17890"
MODEL_NAME="THUDM/chatglm3-6b"
TEMPERATURE=0.0
MAX_NEW_TOKENS=32
MESSAGE="你好"
USER_AGENT="FastChat Client"

# Check if jq is installed
if ! command -v jq &> /dev/null; then
    echo "jq could not be found, please install it to parse JSON responses."
    exit 1
fi

# Send a test message
prompt=1
curl -s -X POST \
    -H "Content-Type: application/json" \
    -H "User-Agent: USER_AGENT" \
    --data '{"model": "THUDM/chatglm3-6b", "prompt": "你好", "temperature": '0.0', "max_new_tokens": "32"}' \
    "$WORKER_ADDRESS/worker_generate_stream"

# Extract the text from the response (assuming the response has a "text" field)
# echo ${response}
# output=$(echo "response" | jq -r '.text')

# echo "output"
